#pragma once
#include <thread>

namespace mystd
{
  class thread_guard
  {
    std::thread &t_;
  public:
    explicit thread_guard(std::thread &t):
    t_(t)
    {
    }
    ~thread_guard()
    {
      if (t_.joinable())
            t_.join();
    }

    thread_guard(const thread_guard&) = delete;
    thread_guard& operator=(const thread_guard&) = delete;
  };

}
